package com.tiantian.springtest01.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @ClassName MyAspect
 * @Description TODO
 * @Author tant
 * @Date 2025/5/28 9:55
 */
@Component
@Aspect
public class MyAspect {

    @Pointcut("execution(* com.tiantian.springtest01.service.AService.*(..))")
    public void pointCut() {
    }


    @Before(value = "pointCut()")
    public void before() {
        System.out.println("before ....");
    }

    @Around("pointCut()")
    public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println("around before ...");
        Object result = proceedingJoinPoint.proceed();
        System.out.println("around after ...");
        return result;
    }
}

    